import App from "./App";
import uviewPlus from "uview-plus";
import store from "./store";

// #ifdef VUE3
import {
	createSSRApp
} from "vue";
import {
	UTCTimeToLocal,
	numberFormat,
	getCountDown,
	getNumIndex,
	getNo,
	isValidPhone
} from "./utils/helper";

Date.prototype.getUTCTime = function() {
	return this.getTime() + this.getTimezoneOffset() * 60 * 1000;
};

export function createApp() {
	const app = createSSRApp(App);

	app.use(store);
	app.use(uviewPlus);

	app.config.globalProperties.UTCTimeToLocal = UTCTimeToLocal;
	app.config.globalProperties.numberFormat = numberFormat;
	app.config.globalProperties.getCountDown = getCountDown;
	app.config.globalProperties.getNumIndex = getNumIndex;
	app.config.globalProperties.isValidPhone = isValidPhone;
	app.config.globalProperties.getNo = getNo;

	return {
		app
	};
}
// #endif
